home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
common
/
sms.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
984b
|
34 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
from string import digits
SMS_MAX_LENGTH = 135
def normalize_sms(sms_number):
sms_number = str(sms_number)
for ch in ' ()-.+':
sms_number = sms_number.replace(ch, '')
if not all((lambda .0: for s in .0:
s in digits)(sms_number)):
raise ValueError('invalid sms number: ' + repr(sms_number))
if len(sms_number) == 10:
sms_number = '1' + sms_number
if len(sms_number) != 11:
raise ValueError('invalid sms number: ' + repr(sms_number))
return str(sms_number)
def validate_sms(n):
try:
normalize_sms(n)
except ValueError:
return False
return True